package com.Lgwd.service.userService.userImpl;

import com.Lgwd.entity.UserAccountEntiy;
import com.Lgwd.repository.UserAccountRepository;
import com.Lgwd.service.userService.UserAccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class UserAccountServiceImpl implements UserAccountService {


    @Autowired
    UserAccountRepository userAccountRepository;

    /**
     * 账号注册
     *
     * @param userAccount
     */
    @Override
    public void addUserInfo(UserAccountEntiy userAccount) {


        userAccountRepository.save(userAccount);


    }

    /**
     * 查询账号是否存在
     *
     * @param userAccount
     * @return
     */
    @Override
    public Object findUserAccount(String userAccount) {
        UserAccountEntiy user = userAccountRepository.findByUser_account(userAccount);
        if (user != null) {
            return "账号已存在";
        }
        return null;
    }
}
